home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / parallax / overview.doc < prev    next >
Text File  |  1994-09-01  |  3KB  |  115 lines

  1. Here is a skeleton of the main loop:
  2.  
  3.  
  4. 1) px and py are the players coordinates.
  5.    These are kept in world coords.
  6.    The world coords range in value from
  7.       0..32*<x or y size of map>
  8.  
  9.    I use 32 because my tiles are 32X32...
  10.  
  11. 2)
  12.  
  13.  
  14.       screen_x := px SHR 5;      { Transform world coords to map coords }
  15.       screen_x := screen_x - 4;
  16.  
  17.       screen_y := py SHR 5;
  18.       screen_y := screen_y - 2;
  19.  
  20.       soff_x := px AND 31;       { Need offset in current map x, y }
  21.       soff_y := py AND 31;       { Same as px MOD 32 }
  22.  
  23.       off_x := soff_x;           { Save offsets, needed for background to }
  24.       off_y := soff_y;           { work right in some instances...}
  25.  
  26.  
  27.       IF (screen_x < 1) THEN     { Next stuff is so that player }
  28.       BEGIN                      { Moves close to edge of screen }
  29.          screen_x := 1;          { if near map edge...}
  30.          soff_x    := 0;
  31.       END
  32.       ELSE
  33.       IF (screen_x > 117) THEN
  34.       BEGIN
  35.         screen_x := 117;
  36.         soff_x   := 31;
  37.       END;
  38.  
  39.       IF (screen_y < 1) THEN
  40.       BEGIN
  41.          screen_y := 1;
  42.          soff_y    := 0;
  43.       END
  44.       ELSE
  45.       IF (screen_y > 119) THEN
  46.       BEGIN
  47.         screen_y := 119;
  48.         soff_y   := 31;
  49.       END;
  50.  
  51.       Draw_Screen_ASM (screen_x, screen_y, soff_x, soff_y, shape_ptr^,
  52.                        bshape_ptr^, map^, bmap^, Close_Terrain,
  53.                        FAnim^, BAnim^, bscroll);
  54.  
  55.   **** shape_ptr, bshape_ptr are pointers to the tile images for
  56.        background and foreground.
  57.  
  58.   **** map, bmap are pointer to the map arrays for fore and back.
  59.  
  60.   **** FAnim and BAnim are pointers to the animation records for
  61.        the foreground and background...
  62.  
  63.   **** Close terrain is a structure set up to hold data on images
  64.        found to be covering the player...
  65.  
  66.  
  67.       Draw_People;          { Draws the player as of now }
  68.  
  69.  
  70.       { Draw stuff the player passes behind }
  71.       Draw_Close_Terrain (Shape_Ptr^, Close_Terrain);
  72.  
  73.  
  74.       { Blit virtual screen to video mem }
  75.       Copy_Part_Screen_Diff (0, 0, 0+soff_x, 0+soff_y, 270, 160)
  76.  
  77.  
  78.  
  79. 3) Thats basically the main loop...
  80.  
  81.  
  82.  
  83. See provided routines.doc file for the procedures that are called...
  84.  
  85.  
  86.  
  87.  
  88.  
  89. **** Overview of structures:
  90.  
  91.  
  92.     Close_Terrain_Type = ARRAY[0..199] of byte;
  93.     Shape_Type        = ARRAY[0..65534] of char;
  94.     Shape_Type_Ptr    = ^Shape_Type;
  95.     Shape_Mask_Type   = ARRAY[0..4095] of byte;
  96.     Shape_Mask_Ptr    = ^Shape_Mask_Type;
  97.     Shape_Anim_Type   = ARRAY[0..1023]  of byte;
  98.     Shape_Anim_Ptr    = ^Shape_Anim_Type;
  99.     Map_Type          = ARRAY[0..16383] of byte;
  100.     Map_Ptr           = ^Map_Type;
  101.  
  102.     ** player_ptr is a pointer to the players image data, like all
  103.        the rest...
  104.  
  105.     ** bscroll is a variable that determines if the background
  106.        will scroll or not..
  107.  
  108.        If zero, will not scroll..
  109.        If > zero, will scroll...
  110.  
  111.        This was not fully implemented when I quit working on
  112.        this engine...
  113.  
  114.  
  115.